/**
 * <li>文件名：LoginPurviewCheckFilter.java
 * <li>说明：
 * <li>创建人： 曾明辉
 * <li>创建日期：2008-12-8
 * <li>修改人： 
 * <li>修改日期：
 */
package com.gp.base.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



/**
 * 
 * <li>类型名称：
 * <li>说明：验证dwr是否过期的过滤器
 * <li>创建人： 曾明辉
 * <li>创建日期：2008-12-8
 * <li>修改人： 
 * <li>修改日期：
 */
public class DwrFilter implements Filter {
	public DwrFilter() {
		super();
	}

	public void init(FilterConfig config) throws ServletException {
		
	}

	@SuppressWarnings("unchecked")
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain filterChain) throws IOException, ServletException {
		
		HttpServletRequest httpRequest = (HttpServletRequest)request;
		HttpServletResponse httpResponse = (HttpServletResponse)response;
		
		if(httpRequest.getSession().getAttribute(LoginPurviewCheckFilter.USER_SESSION_NAME) == null){//未登录
		    httpResponse.setStatus(1000);
			return;
		}

		
		filterChain.doFilter(httpRequest,httpResponse);
	}

	
	public void destroy() {

	}

}
